﻿//=====================================================================================================
// LocalizationLibrary
// The Localization Library is a collection of reusable software components that provide 
// support for localization. This library enables you to localize WPF, Silverlight and WP7 applications.
// (http://localizationlibrary.codeplex.com)
//=====================================================================================================
// Author: Nicola Gallo (Website: www.nicola.gallo.name, Email: nicolagmt@hotmail.it) 
//=====================================================================================================

namespace LocalizationLibrary.Tests.Core
{
    //.NET References
    using System;
    using System.Text;
    using System.Collections.Generic;
    using System.Linq;

    //LocalizationLibrary References
    using LocalizationLibrary.Messaging;

    // Microsoft References
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    public class DynamicResourceTokenTest
    {
        [ExpectedException(typeof(ArgumentException))]
        [TestMethod]
        public void New_Instance_Thrown_ArgumentException_If_ResourceID_Is_Null()
        {
            DynamicResourceToken instance = new DynamicResourceToken(String.Empty, (Language)"it");
        }

        [ExpectedException(typeof(ArgumentNullException))]
        [TestMethod]
        public void New_Instance_Thrown_ArgumentNullException_If_Language_Is_Null()
        {
            DynamicResourceToken instance = new DynamicResourceToken(Guid.NewGuid().ToString(), null);
        }

        [TestMethod]
        public void Verify_If_Two_Instance_Are_Equals()
        {
            String resourceID = Guid.NewGuid().ToString();
            Language language = (Language)"it";
            DynamicResourceToken instance = new DynamicResourceToken(resourceID, language);

            Assert.AreEqual(instance.Equals(null), false);
            Assert.AreEqual(instance.Equals(instance), true);

            DynamicResourceToken instance2 = new DynamicResourceToken(resourceID, language);

            Assert.AreEqual(instance.Equals(instance2), true);

            instance2 = new DynamicResourceToken(Guid.NewGuid().ToString(), language);

            Assert.AreEqual(instance.Equals(instance2), false);

            instance2 = new DynamicResourceToken(resourceID, (Language)"en");

            Assert.AreEqual(instance.Equals(instance2), false);
        }
    }
}